﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="../lib/html5.js"></script>
    <script type="text/javascript" src="../lib/respond.min.js"></script>
    <script type="text/javascript" src="../lib/PIE_IE678.js"></script>
    <![endif]-->
    <link href="../lib/layui/css/layui.css" rel="stylesheet" type="text/css" />
    <link href="../css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link href="../css/H-ui.admin.css" rel="stylesheet" type="text/css" />
    <link href="../lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="../lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>生产加工登记</title>
</head>
<body>
    <div class="pd-5">
        <!--   <div id="tab-category" class="HuiTab">
            <div class="tabBar cl" id="tab-categorybar">
                <span>
                    <label id="lb_worktypeshow">作业基本信息</label></span><span>作业图片信息</span><span>作业用料信息</span>
            </div>
            <div class="tabCon" id="divtab1">
                12
            </div>
            <div class="tabCon" id="divtab2">
                23
            </div>
        </div>-->
        <div class="row cl">
            <div class="formControls col-5">
                <span class="l">
                    <a href="javascript:;" onclick="hcrainOpenDiv('采摘入库明细','sctaskoutstore_inLogList.html')" class="btn btn-danger   round"><i class="Hui-iconfont">&#xe687;</i> 管理入库明细</a>
                    <a href="javascript:;" onclick="hcrainOpenDiv('原料库存明细','sctaskYlstoreList.html')" class="btn btn-danger   round"><i class="Hui-iconfont">&#xe687;</i> 管理原料库存明细</a>
                    <a href="javascript:;" onclick="opencodelist();" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe645;</i>管理发货条码</a>
                </span>
            </div>
        </div>
        <div class="row cl" id="findfdiv">
            <div class="formControls col-2"></div>
            <div class="formControls col-6">
                <input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" placeholder="采摘时间" id="findinfodt1_times" name="findinfodt1_times" class="input-text Wdate" style="width: 120px;">
                <!-- <input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" placeholder="采摘时间" id="findinfodt1_timee" name="findinfodt1_timee" class="input-text Wdate" style="width: 120px;">-->
              

                <input type="text" class="input-text" placeholder="地块" id="finddcinfo" name="finddcinfo" style="width: 120px;">


            </div>
            <div class="formControls col-3  layui-form">
                <select name="ftasksctype" id='ftasksctype' lay-filter="layseltasksctype" lay-search="">
                    <option value="">直接选择或搜索选择</option>
                </select>
            </div>

            <div class="formControls col-1">
                <button onclick="hcrainpage()" class="btn btn-success radius" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 查询</button>
            </div>

        </div>
        <div class="cl pd-5 bg-1 bk-gray mt-5 ">
            <div class="form form-horizontal">
                <div class="row cl" style="margin-top: 0px">
                    <div class="formControls col-2">
                        <span class="select-box">
                            <select class="select" size="1" name="finouttype" id="finouttype">
                                <option value="发往加工中心">发货记录登记</option>
                            </select>
                        </span>
                    </div>
                    <div class="formControls col-2">
                        <input type="text" class="input-text" placeholder="出库说明" id="foutdesc" name="foutdesc">
                    </div>

                    <div class="formControls col-1">
                        <span class="select-box">
                            <select class="select" size="1" name="fcarid" id="fcarid"></select>
                        </span>
                    </div>
                    <label class="form-label col-1">交接人：</label>
                    <div class="formControls col-2 layui-form">
                        <select name="inoutusernamesel" id='inoutusernamesel' lay-filter="testselect" lay-verify="required" lay-search="">
                            <option value="">直接选择或搜索选择</option>
                        </select>
                    </div>
                    <label class="form-label col-1">发货日期：</label>
                    <div class="formControls col-2">
                        <input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" name="testdataaddtime" id="testdataaddtime" class="input-text Wdate" />
                    </div>
                    <div class="formControls col-1"><a href="javascript:;" onclick="savetotaskstre()" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 提交</a></div>
                </div>
            </div>
        </div>

        <div id="hcvueapp" class="mt-5 ml-20">
            <table class="table table-border table-bordered table-hover" style="margin: 0px; padding: 0px;">
                <thead>
                    <tr>
                        <th>地块</th>
                        <th>品种</th>
                        <th>采框</th>
                        <th>入库量</th>

                        <th style="color: #FF0000;">散框数</th>
                        <th style="color: #FF0000;">散量（Kg）</th>
                        <th style="color: #FF0000;">散包数</th>

                        <th style="color: #0000ff;">包框数</th>
                        <th style="color: #0000ff;">包量（Kg）</th>
                        <th style="color: #0000ff;">包包数</th>
                    </tr>
                </thead>
                <tbody>
                    <!--  0 as sks,0 skg,0 sbs,0 bks,0 bkg,0 bbs,   csgetpc,采收日期,计划编号,区域,类型,地块,组长,负责人,面积,品种, sum(`采摘量`) 采摘量,sum(`入库量`) 入库量,单位,sum(`扣数`)扣数,sum(`框数`) 框数,dataaddtime,dataadduserid,dataaddusername,databranchid,databranchname,datadepid,datadepname,品种ID,作业ID,任务ID,地块ID,szkgallcout,szbsallcout,szksallcout-->
                    <tr v-for="site in listinfo">
                        <td>{{ site.csgetpc}}-地块：{{ site.地块}}-采收日期：{{ site.采收日期}}</td>
                        <td>{{ site.品种}} </td>
                        <td>{{ site.框数}}</td>
                        <td>{{ site.入库量}} </td>
                        <td>
                            <input type="number" class="input-text" style="width: 80px;" placeholder="散框数" v-model.number="site.sks" />
                        </td>
                        <td>
                            <input type="number" class="input-text" style="width: 80px;" placeholder="散量" v-model.number="site.skg" />
                        </td>
                        <td>
                            <input type="number" class="input-text" style="width: 80px;" placeholder="散包数" v-model.number="site.sbs" />
                        </td>
                        <td>
                            <input type="number" class="input-text" style="width: 80px;" placeholder="包框数" v-model.number="site.bks" />
                        </td>
                        <td>
                            <input type="number" class="input-text" style="width: 80px;" placeholder="包量" v-model.number="site.bkg" />
                        </td>
                        <td>
                            <input type="number" class="input-text" style="width: 80px;" placeholder="包包数" v-model.number="site.bbs" />
                        </td>
                    </tr>
                </tbody>
            </table>




            <div class="mt-5 row">
                <div id="page1"></div>
            </div>

        </div>
    </div>

    <script type="text/javascript" src="../lib/layui/layui2.js"></script>
    <script type="text/javascript" src="../js/vue.min.js"></script>
    <script>
        var hcvueapp = new Vue({
            el: '#hcvueapp',
            data: {
                listinfo: []
            },
            methods: {

            }
        })
    </script>
    <script src="../hcjsui/Scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="../lib/layui/layui.js"></script>
    <script type="text/javascript" src="../lib/layer/1.9.3/layer.js"></script>
    <script type="text/javascript" src="../lib/laypage/1.2/laypage.js"></script>
    <script type="text/javascript" src="../lib/My97DatePicker/WdatePicker.js"></script>
    <script src="../hcjsui/js/_Define.js" type="text/javascript"></script>
    <script type="text/javascript" src="../js/hcui.js"></script>
    <script type="text/javascript" src="../js/hcui_list.js"></script>

    <script type="text/javascript">
        function opencodelist() {
            hcrainOpenDiv('管理条码明细', 'sctaskoutstoreGroup_Code-ae.html?action=add&urlgettime=' + $("#findinfodt1_times").val() + "&urlsettime=" + $("#testdataaddtime").val());
        }

        var uiform = null;

        $("#findinfodt1_times").val((getDateByChange(new Date(), 0)).Format("yyyy-MM-dd"));
        $("#testdataaddtime").val((getDateByChange(new Date(), 0)).Format("yyyy-MM-dd"));//开始时间
        $(function () {
            spsetBaseNoBt("yw_baseinfo", "id", "yw_baseinfo as T", "*", "#tablelist", "sctaskoutstore", "生产任务管理", "sctaskoutstore");
            hcdoselbyPost("id,fv1 as name", "yw_baseinfo", "type='16' and  maintype='16' and databranchid=" + HCUser.HCUorg, "", "", "id",
                   function (data) {
                       SetSelectWithArrayIdName("#fcarid", data);
                   });
            layui.use(['form'], function () {
                uiform = layui.form();
                //种植物
                hcdoselbyPost("id,concat(fv1,fv7) as name,fv7", "yw_baseinfo", "type=1 and maintype=1", "", "", "id",
                       function (data) {
                           jjm = data;
                           SetSelectWithArrayIdName("#ftasksctype", data, "选择品种", "no");
                           if (uiform) uiform.render('');//这个好像不用再保留了
                       });

                //人员下拉加载
                hcdoselbyPost("empid  as id,concat(depname,'-',empname) as name,empname as username,mobile as  tel,depname as address", "view_user", "branchid='" + HCUser.HCUorg + "'", "", "", "id",
                    function (data) {
                        SetSelectWithArrayIdName("#inoutusernamesel", data);
                        uiform.render();
                    });
            });

            hcrainpage(1);
            //$.Huitab("#tab-category .tabBar span", "#tab-category .tabCon", "current", "click", "0");
            //$.Huifold("#Huifold2 .item h4", "#Huifold2 .item .info", "", 3, "click"); /*5个参数顺序不可打乱，分别是：相应区,隐藏显示的内容,速度,类型,事件 mouseover click */
        });
        //出库处理
        function savetotaskstre() {

            if ($("#testdataaddtime").val()) {

            }
            else {
                layer.msg("发货/处理日期，不能为空", { icon: 2 });
                return;
            }
            var needupdate = 0;
            var message = "";//"<input id='ssssssssss'></input>";
            var postworklist = [];
            //savetotaskstreDo();
            //return;
            layer.confirm('确认信息：' + '<br/>发货/处理日期：' + $("#testdataaddtime").val() + '<br/>', {
                btn: [$("#finouttype").val(), '取消'] //按钮
            }, function () {
                //是否库存足够
                hcui_ajaxasync = false;


                savetotaskstreDo();

            }, function () {
            });
        }
        function ityzl_SHOW_LOAD_LAYER() {
            return layer.msg('提交中，正常情况需要2秒~1分钟（如果记录较多，建议分类查询再提交。）请耐心等待--', { icon: 16, shade: [0.5, '#f5f5f5'], scrollbar: false, time: 60000 * 2 });
            //return layer.msg('提交中，预计需要10s~30s...', { icon: 16, shade: [0.5, '#f5f5f5'], scrollbar: false, offset: '0px', time: 100000 });
        }
        function ityzl_CLOSE_LOAD_LAYER(index) {
            layer.close(index);
        }
        function ityzl_SHOW_TIP_LAYER(info) {
            layer.msg(info, { icon: 1 });
            l//ayer.msg(info, { time: 1000, offset: '10px' });
        }



        function savetotaskstreDo() {
            hcui_ajaxasync = false;
            var outguid = NewGuid();
            var needupdate = 0;
            var updatecount = 0;
            var sendallinfo = {
                "OrgName": HCUser.HCUorgName,
                "LoginInfo": {
                    "UserId": HCUser.HCUide, "UserName": HCUser.HCUname, "UserTitle": HCUser.HCUtitle,
                    "UserOrgId": HCUser.HCUorg, "UserDepId": HCUser.HCUdep, "UserOrgName": HCUser.HCUorgName,
                    "UserOrgCode": HCUser.HCUorgCode
                },
                Info: []
            };


            for (var index in hcvueapp.listinfo) {
                var subinfo = hcvueapp.listinfo[index];
                sendallinfo.Info.push({
                    "outdesc": "",
                    "pickno": subinfo.csgetpc,
                    "sendday": $("#testdataaddtime").val(),
                    "sendToOrgId": 150,
                    "ylks": subinfo.sks,
                    "ylkg": subinfo.skg,
                    "ylbs": subinfo.sbs,
                    "cpks": subinfo.bks,
                    "cpkg": subinfo.bkg,
                    "cpbs": subinfo.bbs
                });
            }
            //hcapipost("../api/HcAPI/PostPickSend", sendallinfo, function (data) {
            //    alert(data);
            //});
            var i;
            $.ajax({
                type: "post",
                url: "../api/HcAPI/PostPickSend",
                data: JSON.stringify(sendallinfo),
                contentType: "application/json", //必须有
                dataType: "json",
                timeout: 60000 * 2,
                async: true,
                cache: false,
                beforeSend: function () {
                    i = ityzl_SHOW_LOAD_LAYER();
                },
                success: function (msg) {
                    ityzl_CLOSE_LOAD_LAYER(i);
                    ityzl_SHOW_TIP_LAYER(msg);
                },
                error: function (e, jqxhr, settings, exception) {
                    ityzl_CLOSE_LOAD_LAYER(i);
                }
            });

            return;

            $.ajax({
                type: "POST",
                dataType: "text",
                url: "admin/index.action",
                beforeSend: function () {
                    i = ityzl_SHOW_LOAD_LAYER();
                },
                success: function (msg) {
                    ityzl_CLOSE_LOAD_LAYER(i);
                    ityzl_SHOW_TIP_LAYER();
                },
                error: function (e, jqxhr, settings, exception) {
                    ityzl_CLOSE_LOAD_LAYER(i);
                }
            });


            return;
            if (false) for (var index in hcvueapp.listinfo) {
                var subinfo = hcvueapp.listinfo[index];

                //0 as sks,0 skg,0 sbs,0 bsk,0 bkg,0 bbs,
                //插入原料
                var addinfobase = "csgetpc%" + subinfo.csgetpc
                 + "$settocenterid%" + 150
                 + "$productstate%原料"
                 + "$setdate%" + $("#testdataaddtime").val()
                 + "$slcs%" + subinfo.sks
                 + "$sljl%" + subinfo.skg
                 + "$allbs%" + subinfo.sbs
                ;

                var haserror = false;
                //{'settype':3,'byfile_name':'fuc_delOldtask_send_infoByInfo'}
                hcdoadd2017("task_send_info", addinfobase, 0, "{'settype':3,'byfile_name':'fuc_delOldtask_send_infoByInfo'}", function (info) {
                    //更新记录--已出库
                    if (info == "ok") {

                        var addinfo = "csgetpc%" + subinfo.csgetpc + "$outgid%" + outguid
                            + "$inouttype%" + $("#finouttype").val()
                            + "$outdesc%" + $("#foutdesc").val()
                            + "$dkid%" + subinfo.地块ID
                            + "$dkname%" + subinfo.地块
                            + "$taskid%" + subinfo.任务ID
                            + "$taskno%" + subinfo.计划编号
                            + "$tasklistid%" + subinfo.作业ID
                            + "$storehouseid%0$hasoutall%0"//默认初始化
                            + "$productid%" + subinfo.品种ID
                            + "$productname%" + subinfo.品种

                            + "$storeall%" + subinfo.skg
                            + "$storefortype1%" + subinfo.sbs
                            + "$storeksall%" + subinfo.sks
                              + "$productstate%原料"

                            + "$taskfromorgid%" + subinfo.databranchid
                            + "$taskfromorgname%" + subinfo.databranchname
                            //+ "$datafromtable%hsc_task_store"
                            + "$taskworktime%" + subinfo.采收日期//采摘时间
                            + "$datafromkeyid%" + subinfo.作业ID
                            + "$jjuserid%" + $("#inoutusernamesel").val()
                            + "$jjusername%" + $("#inoutusernamesel").find("option:selected").text();


                        var addinfototable = "hsc_task_store_out";
                        addinfo = addinfo
                            + "$outstate%运输中"
                            + "$inoutstorestate%待入库"
                            + "$datafromtable%hsc_task_info"
                            + "$datafromdesc%出库" + "$carid%" + $("#fcarid").val()
                        + "$carinfo%" + $("#fcarid").find("option:selected").text();


                        addinfo = addinfo + "$dataaddtime%" + $("#testdataaddtime").val();//重指时间


                        hcdoadd2017(addinfototable, addinfo, 2, "{'settype':3,'byfile_name':'fuc_delOldStoreOutByGroup','insertcheck':'storeallstoreksall大于0'}", function (info) {
                            //更新记录--已出库
                            if (info == "ok") {
                                updatecount++;
                            }
                            else { haserror = true; layer.msg('生成发货记录失败A：' + info, { icon: 2 }); }
                        });




                    }
                    else { haserror = true; layer.msg('保存发货失败A：' + info, { icon: 2 }); }
                });
                if (haserror) return;

                var addinfobase = "csgetpc%" + subinfo.csgetpc
                + "$settocenterid%" + 150
                + "$productstate%包装品"
                + "$setdate%" + $("#testdataaddtime").val()
                + "$slcs%" + subinfo.bks
                + "$sljl%" + subinfo.bkg
                + "$allbs%" + subinfo.bbs
                ;

                hcdoadd2017("task_send_info", addinfobase, 0, "{'settype':3,'byfile_name':'fuc_delOldtask_send_infoByInfo'}", function (info) {
                    //更新记录--已出库
                    if (info == "ok") {

                        var addinfo = "csgetpc%" + subinfo.csgetpc + "$outgid%" + outguid
                            + "$inouttype%" + $("#finouttype").val()
                            + "$outdesc%" + $("#foutdesc").val()
                            + "$dkid%" + subinfo.地块ID
                            + "$dkname%" + subinfo.地块
                            + "$taskid%" + subinfo.任务ID
                            + "$taskno%" + subinfo.计划编号
                            + "$tasklistid%" + subinfo.作业ID
                            + "$storehouseid%0$hasoutall%0"//默认初始化
                            + "$productid%" + subinfo.品种ID
                            + "$productname%" + subinfo.品种

                            + "$storeall%" + subinfo.bkg
                            + "$storefortype1%" + subinfo.bbs
                            + "$storeksall%" + subinfo.bks
                              + "$productstate%包装品"

                            + "$taskfromorgid%" + subinfo.databranchid
                            + "$taskfromorgname%" + subinfo.databranchname
                            //+ "$datafromtable%hsc_task_store"
                            + "$taskworktime%" + subinfo.采收日期//采摘时间
                            + "$datafromkeyid%" + subinfo.作业ID
                            + "$jjuserid%" + $("#inoutusernamesel").val()
                            + "$jjusername%" + $("#inoutusernamesel").find("option:selected").text();


                        var addinfototable = "hsc_task_store_out";
                        addinfo = addinfo
                            + "$outstate%运输中"
                            + "$inoutstorestate%待入库"
                            + "$datafromtable%hsc_task_info"
                            + "$datafromdesc%出库" + "$carid%" + $("#fcarid").val()
                        + "$carinfo%" + $("#fcarid").find("option:selected").text();


                        addinfo = addinfo + "$dataaddtime%" + $("#testdataaddtime").val();//重指时间


                        hcdoadd2017(addinfototable, addinfo, 2, "{'settype':3,'byfile_name':'fuc_delOldStoreOutByGroup','insertcheck':'storeallstoreksall大于0'}", function (info) {
                            //更新记录--已出库
                            if (info == "ok") {
                                updatecount++;
                            }
                            else { haserror = true; layer.msg('生成发货记录失败B：' + info, { icon: 2 }); }
                        });




                    }
                    else { haserror = true; layer.msg('保存发货失败B：' + info, { icon: 2 }); }
                });
                if (haserror) return;





            }

            hcapigetNoError("../api/Task/GetReSetOutInfoToCenter", { "databranchid": HCUser.HCUorg, "day": $("#testdataaddtime").val() }, function (backdata) {
            });

            layer.msg('完成操作，记录数：' + updatecount, { icon: 1 });
            //重新加载
            if (updatecount > 0) {
                hcrainpage(1);
            }



        }

        function hcrainpage(curr) {
            var suminfowhere1 = "";
            var spid = $("#ftasksctype").val();
            var suminfowhere = "";
            if (spid && spid != "no") {

                suminfowhere = " and 品种ID  = " + spid + " ";
            }


            var finddcinfo = $("#finddcinfo").val();
            if (finddcinfo) {
                suminfowhere += " and 地块  like '%" + finddcinfo + "%'";
            }


            if ($("#findinfodt1_times").val()) {
                suminfowhere1 += " and taskworktime>='" + $("#findinfodt1_times").val() + " 00:00:00'";
                suminfowhere += " and 采收日期>='" + $("#findinfodt1_times").val() + " 00:00:00'";

                suminfowhere1 += " and taskworktime<='" + $("#findinfodt1_times").val() + " 23:59:59'";
                suminfowhere += "and 采收日期<='" + $("#findinfodt1_times").val() + " 23:59:59'";
            }
            else {
                layer.msg('采摘日期不能为空', { icon: 2 });
                return;
            }
            var where_send = "";
            if ($("#testdataaddtime").val()) {
                where_send = "setdate-||=||" + $("#testdataaddtime").val() + " 00:00:00";
            }
            else {
                layer.msg('发货日期不能为空', { icon: 2 });
                return;
            }


            $.ajax({
                type: "post",
                url: "../ashx/spui.ashx",
                data: {
                    "action": "getpageinfo",
                    "pagenow": curr || 1,
                    "pagesize": 50,
                    "select": "0 as sks,0 skg,0 sbs,0 bks,0 bkg,0 bbs, csgetpc,采收日期,计划编号,区域,类型,地块,组长,负责人,面积,品种, sum(`采摘量`) 采摘量,sum(`入库量`) 入库量,单位,sum(`扣数`)扣数,sum(`框数`) 框数,dataaddtime,dataadduserid,dataaddusername,databranchid,databranchname,datadepid,datadepname,品种ID,作业ID,任务ID,地块ID,szkgallcout,szbsallcout,szksallcout",
                    "table": "v采收报表 as t ",
                    "group": "csgetpc",
                    "having": "",
                    "where": " t.databranchid= " + HCUser.HCUorg + suminfowhere,//有库存的
                    "order": "",
                    "subinfo": "*" +
                       "#task_send_info#csgetpc-@csgetpc," + where_send + "#csgetpc#"//子查询   当前物品+当前机构+库存大于0
                },
                async: true,
                cache: false,
                error: function (error) {

                },
                success: function (data) {
                    var result = JSON.parse(data);
                    hcvueapp.listinfo = result.data;
                    //if (hcvueapp.listinfo == null || hcvueapp.listinfo.length == 0) {
                    //    result.message = "没有数据"; /// / / layer.msg('没有相关数据噢', { icon: 5 });
                    //}
                    ////"0 as sks,0 skg,0 sbs,0 bks,0 bkg,0 bbs,
                    if (hcvueapp.listinfo != null && hcvueapp.listinfo.length > 0) hcvueapp.listinfo.forEach(function (e) {
                        e.subinfo.forEach(function (list) {
                            if (list.productstate == "原料") {
                                e.sks = list.slcs;
                                e.skg = list.sljl;
                                e.sbs = list.allbs;
                            }
                            if (list.productstate == "包装品") {
                                e.bks = list.slcs;
                                e.bkg = list.sljl;
                                e.bbs = list.allbs;
                            }
                        });
                    });
                    //显示分页
                    laypage({
                        cont: 'page1', //容器。值支持id名、原生dom对象，jquery对象。【如该容器为】：<div id="page1"></div>
                        pages: result.message || 0, //通过后台拿到的总页数
                        curr: curr || 1, //当前页
                        jump: function (obj, first) { //触发分页后的回调
                            if (!first) { //点击跳页触发函数自身，并传递当前页：obj.curr
                                hcrainpage(obj.curr);
                            }
                        }
                    });

                }
            });



        };

        //重新加载-重载
        function findreolad(isback) {
            hcrainpage(1);
        }


        function getDateByChange(date, days) {
            if (days == undefined || days == '') {
                days = 1;
            }
            var date = new Date(date);
            date.setHours(date.getHours() - days);
            return date;

        }

    </script>
</body>
</html>
